package com.assistant.dubbo.provider;

import com.assistant.api.dto.CommonDto;
import com.assistant.api.facade.ToolFacade;
import com.assistant.api.request.SysOperLogSearchReq;
import com.assistant.api.response.SysOperLogSearchResp;
import com.assistant.api.response.UserSearchResp;
import com.assistant.util.SnowflakeIdGenerator;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;

@Slf4j
@DubboService(version = "1.0.0")
public class ToolFacadeImpl implements ToolFacade {


    @Override
    public CommonDto getResult(Long id) {
        log.info("入参id={}",id);
        return new CommonDto();
    }

    @Override
    public String generateUniqueKey() {
        String key = Long.toString(new SnowflakeIdGenerator(0, 0).nextId());
        log.info("生成key:{}", key);
        return key;
    }

    @Override
    public UserSearchResp searchUser(Long userId, String realName) {
        UserSearchResp userSearchResp = new UserSearchResp();
        userSearchResp.setId(userId);
        userSearchResp.setUserName("");
        userSearchResp.setRealName(realName);
        return userSearchResp;
    }

    @Override
    public SysOperLogSearchResp searchSysOperLogs(SysOperLogSearchReq sysOperLogSearchReq) {
        SysOperLogSearchResp sysOperLogSearchResp = new SysOperLogSearchResp();
        sysOperLogSearchResp.setId(sysOperLogSearchReq.getId());
        sysOperLogSearchResp.setTitle(sysOperLogSearchReq.getTitle());
        sysOperLogSearchResp.setContent("删除用户");
        return sysOperLogSearchResp;
    }

}
